fetcher: Close request body on error paths
authorColin Walters <walters@verbum.org>
Wed, 20 Aug 2014 14:23:28 +0000 (10:23 -0400)
committerColin Walters <walters@verbum.org>
Wed, 27 Aug 2014 18:00:31 +0000 (14:00 -0400)
Otherwise, we're potentially holding up subsequent requests.

I was hitting this when testing the metalink code, where we want to
continue doing more fetches after hitting a 404.

https://bugzilla.gnome.org/show_bug.cgi?id=729585

src/libostree/ostree-fetcher.c

index 298ba63f6f162409a604ac6bc8ede82ef6e69334..3cc3533e85484ec89167ff82702cf4e5da6b38de 100644 (file)
@@ -505,6 +505,8 @@ on_request_sent (GObject        *object,
  out:
   if (local_error)
     {
+      if (pending->request_body)
+        (void) g_input_stream_close (pending->request_body, NULL, NULL);
       g_simple_async_result_take_error (pending->result, local_error);
       g_simple_async_result_complete (pending->result);
       g_object_unref (pending->result);